var path = "/OA";


$(function(){
	console.log("hello");
	var ue = UE.getEditor("container");
	$("#btn").click(function(){
		$.ajax({
			url :path + "/topic/addTopic",
			type :"post",
			data:{
				"title":$("#title").val() , "content" : ue.getContent() ,
				 "forumid":$("#forumid").val(),
				"authorid":$("#authorid").val(),"type":$("#type").val()
				},
			dataType:"json",
			error:function(){
				alert("系统错误");
			},
			success:function(data){
				console.log(data);
				if(data.success){
					layer.alert(data.message,'信息提示',function(){
						location.href= "/OA/main/toPersonalTopic?forumid="+$("#forumid").val();
					});
				}else{
					layer.alert(data.message);
					console.log(data);
				}
			}
		});
	});
});


/*$(function(){
	$("#btn").click(function(){
		$.ajax({
			url :path + "/topic/addTopic",
			type: "post",
			data:$("#myform").serialize(),
			dataType:"json",
			error:function(){
				alert("系统错误");
			},
			success:function(data){
				console.log(data);
				if(data.success){
					layer.alert(data.message,'信息提示',function(){
						location.reload();
					});
					alert(data.message);
					location.href=paht + "/main/toPersonalTopic?forumid="+$("#forumid").val();
				}else{
					alert(data.message);
				}
			}
		});
	});
	
});*/